<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>现代化登录页面</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            position: relative;
        }

        /* 背景动画元素 */
        .background-elements {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
            z-index: 1;
        }

        .element {
            position: absolute;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.1);
            animation: float 15s infinite linear;
        }

        .element:nth-child(1) {
            width: 150px;
            height: 150px;
            top: 10%;
            left: 5%;
            animation-duration: 20s;
        }

        .element:nth-child(2) {
            width: 80px;
            height: 80px;
            top: 60%;
            left: 80%;
            animation-duration: 25s;
            animation-delay: -5s;
        }

        .element:nth-child(3) {
            width: 120px;
            height: 120px;
            top: 30%;
            left: 70%;
            animation-duration: 30s;
            animation-delay: -10s;
        }

        .element:nth-child(4) {
            width: 60px;
            height: 60px;
            top: 80%;
            left: 20%;
            animation-duration: 18s;
            animation-delay: -3s;
        }

        @keyframes float {
            0% {
                transform: translate(0, 0) rotate(0deg);
            }
            25% {
                transform: translate(20px, 20px) rotate(90deg);
            }
            50% {
                transform: translate(0, 40px) rotate(180deg);
            }
            75% {
                transform: translate(-20px, 20px) rotate(270deg);
            }
            100% {
                transform: translate(0, 0) rotate(360deg);
            }
        }

        /* 登录容器 */
        .login-container {
            position: relative;
            z-index: 2;
            width: 100%;
            max-width: 420px;
            padding: 40px;
            background: rgba(255, 255, 255, 0.95);
            border-radius: 20px;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
            backdrop-filter: blur(10px);
            transform: translateY(30px);
            opacity: 0;
            animation: slideUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s forwards;
        }

        @keyframes slideUp {
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        /* Logo 区域 */
        .logo {
            text-align: center;
            margin-bottom: 30px;
        }

        .logo-icon {
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 15px;
            color: white;
            font-size: 24px;
            box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
            transform: scale(0);
            animation: scaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s forwards;
        }

        .logo-text {
            font-size: 28px;
            font-weight: 700;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            opacity: 0;
            animation: fadeIn 0.6s ease 0.8s forwards;
        }

        /* 表单样式 */
        .form-group {
            margin-bottom: 25px;
            position: relative;
            opacity: 0;
            transform: translateY(20px);
        }

        .form-group:nth-child(1) {
            animation: slideIn 0.6s ease 1s forwards;
        }

        .form-group:nth-child(2) {
            animation: slideIn 0.6s ease 1.2s forwards;
        }

        .form-group:nth-child(3) {
            animation: slideIn 0.6s ease 1.4s forwards;
        }

        @keyframes slideIn {
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #333;
            font-size: 14px;
        }

        .input-wrapper {
            position: relative;
        }

        .form-control {
            width: 100%;
            padding: 15px 20px 15px 45px;
            border: 2px solid #e1e5e9;
            border-radius: 12px;
            font-size: 16px;
            transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
            background: #f8fafc;
        }

        .form-control:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
            background: white;
            transform: translateY(-2px);
        }

        .input-icon {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #94a3b8;
            transition: all 0.3s ease;
        }

        .form-control:focus + .input-icon {
            color: #667eea;
            transform: translateY(-50%) scale(1.1);
        }

        /* 密码显示/隐藏按钮 */
        .password-toggle {
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            color: #94a3b8;
            cursor: pointer;
            padding: 5px;
            border-radius: 4px;
            transition: all 0.3s ease;
            opacity: 0;
            visibility: hidden;
        }

        .password-toggle.show {
            opacity: 1;
            visibility: visible;
        }

        .password-toggle:hover {
            color: #667eea;
            background: rgba(102, 126, 234, 0.1);
        }

        /* 记住密码和忘记密码 */
        .form-options {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
            opacity: 0;
            animation: fadeIn 0.6s ease 1.6s forwards;
        }

        .remember-me {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .remember-me input {
            width: 18px;
            height: 18px;
            border-radius: 4px;
            border: 2px solid #d1d5db;
            accent-color: #667eea;
        }

        .remember-me label {
            font-size: 14px;
            color: #64748b;
        }

        .forgot-password {
            color: #667eea;
            text-decoration: none;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .forgot-password:hover {
            color: #764ba2;
            text-decoration: underline;
        }

        /* 登录按钮 */
        .login-btn {
            width: 100%;
            padding: 16px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 12px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
            position: relative;
            overflow: hidden;
            opacity: 0;
            animation: fadeIn 0.6s ease 1.8s forwards;
        }

        .login-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 15px 30px rgba(102, 126, 234, 0.3);
        }

        .login-btn:active {
            transform: translateY(-1px);
        }

        .login-btn:disabled {
            opacity: 0.7;
            transform: none;
            cursor: not-allowed;
        }

        .login-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: left 0.5s;
        }

        .login-btn:hover::before {
            left: 100%;
        }

        /* 其他登录方式 */
        .divider {
            text-align: center;
            margin: 30px 0;
            position: relative;
            opacity: 0;
            animation: fadeIn 0.6s ease 2s forwards;
        }

        .divider::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 0;
            right: 0;
            height: 1px;
            background: #e2e8f0;
        }

        .divider span {
            background: white;
            padding: 0 20px;
            color: #94a3b8;
            font-size: 14px;
        }

        .social-login {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin-bottom: 25px;
            opacity: 0;
            animation: fadeIn 0.6s ease 2.2s forwards;
        }

        .social-btn {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            border: 2px solid #e2e8f0;
            background: white;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

        .social-btn:hover {
            transform: translateY(-5px) scale(1.1);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        }

        .social-btn.google:hover {
            border-color: #db4437;
            color: #db4437;
        }

        .social-btn.facebook:hover {
            border-color: #4267B2;
            color: #4267B2;
        }

        .social-btn.github:hover {
            border-color: #333;
            color: #333;
        }

        /* 注册链接 */
        .signup-link {
            text-align: center;
            opacity: 0;
            animation: fadeIn 0.6s ease 2.4s forwards;
        }

        .signup-link a {
            color: #667eea;
            text-decoration: none;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .signup-link a:hover {
            color: #764ba2;
            text-decoration: underline;
        }

        /* 动画定义 */
        @keyframes scaleIn {
            to {
                transform: scale(1);
            }
        }

        @keyframes fadeIn {
            to {
                opacity: 1;
            }
        }

        /* 响应式设计 */
        @media (max-width: 480px) {
            .login-container {
                margin: 20px;
                padding: 30px 20px;
            }

            .logo-text {
                font-size: 24px;
            }

            .form-options {
                flex-direction: column;
                gap: 15px;
                align-items: flex-start;
            }
        }

        /* 加载动画 */
        .loading {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            border-top-color: white;
            animation: spin 1s ease-in-out infinite;
            margin-right: 10px;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        /* 输入框错误状态 */
        .form-group.error .form-control {
            border-color: #ef4444;
            background: #fef2f2;
        }

        .form-group.error .input-icon {
            color: #ef4444;
        }

        .error-message {
            color: #ef4444;
            font-size: 12px;
            margin-top: 5px;
            display: none;
        }

        .form-group.error .error-message {
            display: block;
        }

        /* 成功状态 */
        .form-group.success .form-control {
            border-color: #10b981;
            background: #f0fdf4;
        }

        .form-group.success .input-icon {
            color: #10b981;
        }
    </style>
</head>
<body>
    <!-- 背景动画元素 -->
    <div class="background-elements">
        <div class="element"></div>
        <div class="element"></div>
        <div class="element"></div>
        <div class="element"></div>
    </div>

    <!-- 登录容器 -->
    <div class="login-container">
        <div class="logo">
            <div class="logo-icon">
                <i class="fas fa-rocket"></i>
            </div>
            <div class="logo-text">Welcome Back</div>
        </div>

        <form id="loginForm">
            <div class="form-group">
                <label for="email">邮箱地址</label>
                <div class="input-wrapper">
                    <input type="email" id="email" class="form-control" placeholder="请输入邮箱地址" required>
                    <i class="fas fa-envelope input-icon"></i>
                </div>
                <div class="error-message">请输入有效的邮箱地址</div>
            </div>

            <div class="form-group">
                <label for="password">密码</label>
                <div class="input-wrapper">
                    <input type="password" id="password" class="form-control" placeholder="请输入密码" required>
                    <i class="fas fa-lock input-icon"></i>
                    <button type="button" class="password-toggle" id="passwordToggle">
                        <i class="fas fa-eye"></i>
                    </button>
                </div>
                <div class="error-message">密码至少需要6位字符</div>
            </div>

            <div class="form-options">
                <div class="remember-me">
                    <input type="checkbox" id="remember">
                    <label for="remember">记住我</label>
                </div>
                <a href="#" class="forgot-password">忘记密码？</a>
            </div>

            <button type="submit" class="login-btn">
                <span class="btn-text">登录</span>
            </button>
        </form>

        <div class="divider">
            <span>或使用其他方式登录</span>
        </div>

        <div class="social-login">
            <div class="social-btn google">
                <i class="fab fa-google"></i>
            </div>
            <div class="social-btn facebook">
                <i class="fab fa-facebook-f"></i>
            </div>
            <div class="social-btn github">
                <i class="fab fa-github"></i>
            </div>
        </div>

        <div class="signup-link">
            还没有账户？<a href="#">立即注册</a>
        </div>
    </div>

    <script>
        // 表单验证和提交
        document.addEventListener('DOMContentLoaded', function() {
            const loginForm = document.getElementById('loginForm');
            const emailInput = document.getElementById('email');
            const passwordInput = document.getElementById('password');
            const passwordToggle = document.getElementById('passwordToggle');
            const loginBtn = document.querySelector('.login-btn');
            const btnText = document.querySelector('.btn-text');

            // 密码输入框内容变化监听
            passwordInput.addEventListener('input', function() {
                if (this.value.length > 0) {
                    passwordToggle.classList.add('show');
                } else {
                    passwordToggle.classList.remove('show');
                    // 如果没有内容且当前是明文状态，切换回密码状态
                    if (this.type === 'text') {
                        this.type = 'password';
                        const icon = passwordToggle.querySelector('i');
                        icon.classList.remove('fa-eye-slash');
                        icon.classList.add('fa-eye');
                    }
                }
            });

            // 密码显示/隐藏切换
            passwordToggle.addEventListener('click', function() {
                const icon = this.querySelector('i');
                if (passwordInput.type === 'password') {
                    passwordInput.type = 'text';
                    icon.classList.remove('fa-eye');
                    icon.classList.add('fa-eye-slash');
                } else {
                    passwordInput.type = 'password';
                    icon.classList.remove('fa-eye-slash');
                    icon.classList.add('fa-eye');
                }
                
                // 添加点击动画效果
                this.style.transform = 'translateY(-50%) scale(0.9)';
                setTimeout(() => {
                    this.style.transform = 'translateY(-50%) scale(1)';
                }, 150);
            });

            // 实时验证邮箱
            emailInput.addEventListener('blur', function() {
                validateEmail(this);
            });

            // 实时验证密码
            passwordInput.addEventListener('blur', function() {
                validatePassword(this);
            });

            // 表单提交
            loginForm.addEventListener('submit', function(e) {
                e.preventDefault();
                
                const isEmailValid = validateEmail(emailInput);
                const isPasswordValid = validatePassword(passwordInput);
                
                if (isEmailValid && isPasswordValid) {
                    // 模拟登录过程
                    simulateLogin();
                }
            });

            // 邮箱验证函数
            function validateEmail(input) {
                const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
                const isValid = emailRegex.test(input.value);
                
                const formGroup = input.closest('.form-group');
                formGroup.classList.remove('error', 'success');
                
                if (input.value && !isValid) {
                    formGroup.classList.add('error');
                    return false;
                } else if (input.value && isValid) {
                    formGroup.classList.add('success');
                    return true;
                }
                
                return false;
            }

            // 密码验证函数
            function validatePassword(input) {
                const isValid = input.value.length >= 6;
                
                const formGroup = input.closest('.form-group');
                formGroup.classList.remove('error', 'success');
                
                if (input.value && !isValid) {
                    formGroup.classList.add('error');
                    return false;
                } else if (input.value && isValid) {
                    formGroup.classList.add('success');
                    return true;
                }
                
                return false;
            }

            // 模拟登录过程
            function simulateLogin() {
                // 显示加载状态
                loginBtn.disabled = true;
                btnText.innerHTML = '<span class="loading"></span>登录中...';
                
                // 模拟API调用
                setTimeout(() => {
                    // 模拟成功登录
                    btnText.textContent = '登录成功！';
                    loginBtn.style.background = 'linear-gradient(135deg, #10b981 0%, #059669 100%)';
                    
                    // 添加成功动画
                    loginBtn.style.transform = 'scale(1.05)';
                    setTimeout(() => {
                        loginBtn.style.transform = 'scale(1)';
                    }, 200);
                    
                    // 重置按钮状态
                    setTimeout(() => {
                        loginBtn.disabled = false;
                        btnText.textContent = '登录';
                        loginBtn.style.background = 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)';
                    }, 2000);
                }, 2000);
            }

            // 社交登录按钮点击效果
            const socialBtns = document.querySelectorAll('.social-btn');
            socialBtns.forEach(btn => {
                btn.addEventListener('click', function() {
                    const platform = this.classList.contains('google') ? 'Google' :
                                   this.classList.contains('facebook') ? 'Facebook' : 'GitHub';
                    
                    this.innerHTML = '<span class="loading"></span>';
                    
                    setTimeout(() => {
                        this.innerHTML = this.classList.contains('google') ? '<i class="fab fa-google"></i>' :
                                       this.classList.contains('facebook') ? '<i class="fab fa-facebook-f"></i>' :
                                       '<i class="fab fa-github"></i>';
                        
                        // 模拟社交登录成功
                        alert(`${platform} 登录成功！`);
                    }, 1500);
                });
            });

            // 忘记密码链接
            document.querySelector('.forgot-password').addEventListener('click', function(e) {
                e.preventDefault();
                alert('密码重置邮件已发送到您的邮箱！');
            });

            // 注册链接
            document.querySelector('.signup-link a').addEventListener('click', function(e) {
                e.preventDefault();
                alert('跳转到注册页面');
            });

            // 输入框焦点效果增强
            const inputs = document.querySelectorAll('.form-control');
            inputs.forEach(input => {
                input.addEventListener('focus', function() {
                    this.parentElement.parentElement.style.transform = 'translateY(-2px)';
                });
                
                input.addEventListener('blur', function() {
                    this.parentElement.parentElement.style.transform = 'translateY(0)';
                });
            });
        });
    </script>
</body>
</html>
